package com.xiaolin.generic;

/**
 * @ClassName GenericClassTest
 * @Description 泛型类
 * @Detail detail
 * @Author MyPC
 * @Date 2020/11/30
 * @Version 1.0
 */
public class GenericClassTest<T> {

    private T data;

    public void setData(T data) {
        this.data = data;
    }

    public T getData(){
        return data;
    }

    public static void main(String[] args) {
        GenericClassTest<Student> g=new GenericClassTest<>();
        Student student = new Student();
        student.setName("小林");
        g.setData(student);
        System.out.println(g.getData().getName());
    }
}

class Student{
    private String name;

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
}
